package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.CommentPageDto;
import com.heima.model.wemedia.dtos.CommentStatusManageDto;
import com.heima.wemedia.service.CommentManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 自媒体文章管理功能控制层
 * @ClassName CommentManageController
 * @Description
 * @Author yangjiangping
 * @Date 2023/6/28 11:53
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/v1/comment/manage")
public class CommentManageController {

    @Autowired
    private CommentManageService commentManageService;

    /**
     * 查询所有文章评论接口 (评论管理查询)
     * @Description
     * @Author YangJiangPing
     * @Date 11:54 2023/6/28
     * @Param []
     * @return com.heima.model.common.dtos.ResponseResult
     **/
    @PostMapping("/find_news_comments")
    public ResponseResult findNewsComments(@RequestBody CommentPageDto dto){
        return commentManageService.findNewsComments(dto);
    }

    /**
     * 打开和关闭评论接口
     * @Description
     * @Author YangJiangPing
     * @Date 8:58 2023/6/29
     * @Param []
     * @return com.heima.model.common.dtos.ResponseResult
     **/
    @PostMapping("/update_comment_status")
    public ResponseResult updateCommentStatus(@RequestBody CommentStatusManageDto dto){
        return commentManageService.updateCommentStatus(dto);
    }
}

